// Header Protection
#ifndef _SYSTEMNODE_H_
#define _SYSTEMNODE_H_

// Include Files
#include "Definitions.h"

// Namespace
namespace IE
{
	/////////////////////////////////////////////////////////////////////////////////
	// A base class from which to derive all system nodes. A system node contains 
	//     all object data relevant to the system it is used for, in a thread 
	//     safe manner.
	class ABCSystemNode
	{
	protected:  // methods
		ABCSystemNode() : m_uRefCount(0) { }
		virtual ~ABCSystemNode() = 0 { }

		// Add a reference to this system node. This should be called whenever a 
		//     pointer to a system node is stored.
		void AddRef() { m_uRefCount++; }

		// Remove a reference from the system node. When this reaches zero, the node 
		//     is deleted.
		void Release() { if( --m_uRefCount == 0 ) delete this; }

	private:    // data
		uint_t m_uRefCount;

	private:    // dummy definitions
		ABCSystemNode( ABCSystemNode const & );
		ABCSystemNode &operator =( ABCSystemNode const & );
	};
}

// Header Protection
#endif // _SYSTEMNODE_H_
